package com.kzw.oa.exam.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.kzw.misc.annotation.S;
import com.kzw.misc.annotation.T;
import com.kzw.oa.system.model.Department;
import com.kzw.oa.system.model.Dictionary;

/**
 * 考试
 */
@Entity
@Table(name = "examine")
public class Examine {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long oid;

	@S
	@T("考试名称")
	@Column(length = 100)
	private String name;

	@T("考试时间")
	@Column(length = 50)
	private String examDate;

	@T("考试状态")
	@S("[[0,'末开始'],[1,'进行中'],[2,'已结束']]")
	private Integer status;

	@T("考试说明")
	@Column(length = 1000)
	private String note;

	// 课程科目
	@ManyToOne
	@JoinColumn(name = "course_type")
	private Dictionary courseType;

	// 适用年级
	@ManyToOne
	@JoinColumn(name = "dept_id")
	private Department dept;

	// 评卷教师，如: ,1,2,
	@Column(length = 100)
	private String teacherIds;

	@Column(length = 100)
	private String teacherNames;

	// 试题：组卷
	@OneToMany(mappedBy = "examine")
	@OrderBy("sn asc")
	private Set<ExamineItem> items = new HashSet<>();

	public Examine() {
	}

	public Examine(Long oid) {
		this.oid = oid;
	}

	public Long getOid() {
		return oid;
	}

	public void setOid(Long oid) {
		this.oid = oid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getExamDate() {
		return examDate;
	}

	public void setExamDate(String examDate) {
		this.examDate = examDate;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public Dictionary getCourseType() {
		return courseType;
	}

	public void setCourseType(Dictionary courseType) {
		this.courseType = courseType;
	}

	public Department getDept() {
		return dept;
	}

	public void setDept(Department dept) {
		this.dept = dept;
	}

	public String getTeacherIds() {
		return teacherIds;
	}

	public void setTeacherIds(String teacherIds) {
		this.teacherIds = teacherIds;
	}

	public String getTeacherNames() {
		return teacherNames;
	}

	public void setTeacherNames(String teacherNames) {
		this.teacherNames = teacherNames;
	}

	public Set<ExamineItem> getItems() {
		return items;
	}

	public void setItems(Set<ExamineItem> items) {
		this.items = items;
	}

}
